package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.Documentation;
import com.eastjet.maintenance.mapper.DocumentationMapper;
import com.eastjet.maintenance.service.DocumentationService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【documentation(关联文档)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:38
 */
@Service
public class DocumentationServiceImpl extends ServiceImpl<DocumentationMapper, Documentation>
        implements DocumentationService {

    /**
     * 新增文档
     *
     * @param documentation
     * @return
     */
    @Override
    public Boolean InsertDocumentation(Documentation documentation) {
        return this.save(documentation);
    }

    /**
     * 删除文档
     *
     * @param documentation
     * @return
     */
    @Override
    public Boolean UpdateDocumentation(List<String> documentation) {
        return this.removeByIds(documentation);
    }

    /*
     * 查询文档
     */
    @Override
    public List<Documentation> SelectDocumentation(String code) {
        return this.list(new QueryWrapper<Documentation>().and(i -> i.eq("code", code).eq("tombstone", "0")));
    }

    /**
     * 批量新增文档
     *
     * @param documentation
     * @return
     */
    @Override
    public Boolean InsertList(List<Documentation> documentation) {
        return this.saveBatch(documentation);
    }
}




